import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sports_new/resources/colours.dart';
import 'package:sports_new/resources/styles.dart';

import '../../../widgets/base/qkd_text.dart';

class ExpertFirstTag extends StatelessWidget {
  const ExpertFirstTag({super.key, required this.tag});

  final String tag;

  @override
  Widget build(BuildContext context) {
    bool isHistory = tag.contains("最高");
    bool isWin = tag.contains("连红");
    String boxText = "";
    String otherText = "";
    if(isHistory){
      boxText = "最高";
      otherText = tag.split("最高").join();
    }else{
      if(isWin){
        boxText = tag.split("连红").join();
        otherText = "连红";
      }else{
        boxText = "近";
        otherText = tag.split("近").join();
      }
    }
    return Container(
      height: 14,
      decoration: const BoxDecoration(
        color: Colours.redFBE0E5,
        borderRadius: BorderRadius.only(
          topRight: Radius.circular(4),
          bottomLeft: Radius.circular(4),
          bottomRight: Radius.circular(4)
        )
      ),
      child: Row(
        children: [
          Container(
            height: 14,
            padding: const EdgeInsets.symmetric(horizontal: 4),
            alignment: Alignment.center,
            decoration: const BoxDecoration(
              color: Colours.redE45849,
              borderRadius: BorderRadius.only(
                topRight: Radius.circular(4),
                bottomLeft: Radius.circular(4)
              )
            ),
            child: QkdText(
              boxText,
              needCenter: true,
              fontSize: 10,color: Colours.white
            )
          ),
          QkdText(
            otherText,
            needCenter: true,
            fontSize: 10,color: Colours.main
          ).paddingSymmetric(horizontal: 4)
        ],
      ),
    );
  }
}
